feat: OCG-backed long-term agent memory with human good/bad feedback links#423
Open
NicholasDCole wants to merge 1 commit into
Open
feat: OCG-backed long-term agent memory with human good/bad feedback links#423NicholasDCole wants to merge 1 commit into
NicholasDCole wants to merge 1 commit into
Conversation
…links Port of the SDK side of agentspan-ai/agentspan#298. - OCGMemoryStore: synchronous MemoryStore HTTP adapter over the OCG BFF (search / save / delete / list, plus minting signed good/bad capability feedback URLs). Bearer-token auth held client-side. - Agent params: semantic_memory, memory_summary_model, feedback_sink. - AgentRuntime pre-run hook injects relevant agent/user-scoped memories into a COPY of the agent's instructions; post-run hook distills the conversation via an internal summarizer sub-agent (structured MemorySummary output, reuses the agent's model unless memory_summary_model is set) and saves it as conversation:<session>. Both hooks are best-effort and recursion-guarded — memory never fails the primary run. - Feedback is human-only: the runtime hands a FeedbackEvent (distilled summary + signed good/bad URLs) to feedback_sink for out-of-band delivery; the URLs are never shown to the agent's LLM. The compiled path registers a spawn-safe {agent}_feedback_sink worker (FeedbackSinkEntry) mirroring run()'s delivery. - Serializer emits longTermMemory {ocgUrl, credential, agent, user, scope, maxResults, summaryModel} and feedbackSink {taskName} so the server-side compiler can inline memory steps on the deployed/webhook path. credential is a server-resolvable secret NAME, never the raw client token. - Example examples/agents/120_ocg_memory.py (renumbered from upstream 118, which is taken here) and unit tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the Python-SDK side of the OCG-backed agent memory feature from agentspan-ai/agentspan#298 onto this repo's
main. Server-side compiler support (inlining the memory retrieval/distill/save/feedback steps on the deployed/webhook path) lives in conductor-oss/conductor (agentspan-server).What it does
OCGMemoryStore(src/conductor/ai/agents/ocg_memory.py, new) — a synchronousMemoryStoreHTTP adapter over the OCG BFF:POST /api/v1/memories/search,POST /api/v1/memories,POST /api/v1/memories/{key}/feedback-links(mints signed good/bad capability URLs), bearer-token auth. PlusMemorySummary/build_memory_summarizer(internal conversation-distiller sub-agent) andFeedbackEvent.semantic_memory,memory_summary_model,feedback_sinkonAgent.{summary, facts, tags}output; reuses the agent's model unlessmemory_summary_modelis set) and saved as aconversation:<session>memory. Best-effort and recursion-guarded — memory never fails the primary run.FeedbackEvent(distilled summary + signed good/bad URLs) tofeedback_sinkfor out-of-band delivery; the URLs are never surfaced to the agent's LLM. The compiled path registers an{agent}_feedback_sinkworker mirroringrun()'s delivery.longTermMemory{ocgUrl, credential, agent, user, scope, maxResults, summaryModel}andfeedbackSink{taskName}on the agent-config JSON.credentialis a server-resolvable secret NAME (defaultOCG_PUBLIC_KEY), never the raw client token.Path adaptations from the upstream PR
conductor.ai.agents.*is unchanged, soocg_memory.pyports verbatim.runtime/_worker_entries.py(withprobe_spawn_safety). The upstream PR's nestedfeedback_sink_workerclosure was therefore ported as a newFeedbackSinkEntryclass, registered via_register_feedback_sink_workerfollowing theStopWhenEntry/GateEntrypattern.118_ocg_memory.py→examples/agents/120_ocg_memory.py(118 and 119 are taken here) and moved intoexamples/agents/.tests/unit/ai/(this repo's layout) instead oftests/unit/.Testing
pytest tests/unit/ai/test_ocg_memory_store.py tests/unit/ai/test_config_serializer.py— 36 passed.pytest tests/unit— 2493 passed, 34 skipped, 0 failed (Python 3.12 venv +pyyaml/pydantic).python -c "import conductor.ai.agents"still succeeds without the agents extras installed (httpx is a base dep; pydantic import inocg_memory.pyis guarded).🤖 Generated with Claude Code